package com.ruibang.glass.purchase.controller;


import com.ruibang.glass.purchase.domain.req.PurchaseReportReq;
import com.ruibang.glass.purchase.entity.PurchaseBidEvaluationReports;
import com.ruibang.glass.purchase.service.PurchaseBidEvaluationReportsService;
import com.teaming.cloud.framework2.common.constant.CommonConstant;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author mameng
 * 评标报告
 */
@Api(tags = "评标报告")
@RestController
@RequestMapping("/api/glass/purchase/report")
public class PurchaseReportController {

    @Autowired
    private PurchaseBidEvaluationReportsService procureBidEvaluationReportsService;

    @PostMapping("/list")
    @ApiOperation(value = "评标报告列表", response = ResultBody.class)
    public ResultBody queryAreas(@RequestBody PurchaseReportReq purchaseReportReq) {
        return ResultBody.success(procureBidEvaluationReportsService.getPage(purchaseReportReq));
    }

    @PostMapping("/add")
    @ApiOperation(value = "评标报告添加", response = ResultBody.class)
    public ResultBody add(@RequestBody PurchaseBidEvaluationReports gProcureBidEvaluationReports) {
        procureBidEvaluationReportsService.addGProcureReportBidders(gProcureBidEvaluationReports);
        return ResultBody.success();
    }

    @PostMapping("/edit")
    @ApiOperation(value = "评标报告修改", response = ResultBody.class)
    public ResultBody edit(@RequestBody PurchaseBidEvaluationReports gProcureBidEvaluationReports) {
        procureBidEvaluationReportsService.updateGProcureBidEvaluationReports(gProcureBidEvaluationReports);
        return ResultBody.success();
    }

    @GetMapping("/getOne/{id}")
    @ApiOperation(value = "评标报告获取对象", response = ResultBody.class)
    public ResultBody getOne(@PathVariable("id") String id) {
        return ResultBody.success(procureBidEvaluationReportsService.getDetail(id));
    }

    @GetMapping("/getById/{id}")
    @ApiOperation(value = "详情", response = ResultBody.class)
    public ResultBody getById(@PathVariable("id") String id) {
        return ResultBody.success(procureBidEvaluationReportsService.getDetail(id));
    }

    @GetMapping("/removeOne/{id}")
    @ApiOperation(value = "采购申请获取对象", response = ResultBody.class)
    public ResultBody removeInfo(@PathVariable("id") String id) {
        procureBidEvaluationReportsService.removeInfo(id);
        return ResultBody.success();
    }

    @GetMapping("/getContractsProject")
    @ApiOperation(value = "合同项目下拉接口", response = ResultBody.class)
    public ResultBody getContractsProject() {
        return ResultBody.success( procureBidEvaluationReportsService.getContractsProject());
    }

    @GetMapping("/getFrameContractsProject")
    @ApiOperation(value = "获取框架合同项目下拉接口", response = ResultBody.class)
    public ResultBody getFrameContractsProject() {
        return ResultBody.success(procureBidEvaluationReportsService.getFrameContractsProject());
    }
}
